package com.beigai.imessage.dao.mapper.ext;

import com.beigai.imessage.dao.mapper.MessageOfflinePOMapper;
import com.beigai.imessage.message.dto.MRecReq;
import com.beigai.imessage.message.dto.MessageUnit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

/**
 * Created by xxl on 2017/5/16.
 */
@Mapper
public interface MessageOfflinePOMapperExt extends MessageOfflinePOMapper {
    @Select({"select",
            "  message, message_sort_num, message_type, ",
            " create_time ",
            "  FROM " +
            "  message_offline a " +
            " WHERE a.`message_from_code` = #{messageFromCode,jdbcType=VARCHAR} " +
            "  AND a.`message_to_code` = #{userCode,jdbcType=VARCHAR} " +
            "  AND a.`status` = 0 " +
            "ORDER BY a.`message_sort_num` ;"})
    @Results({
            @Result(column="message", property="message", jdbcType=JdbcType.VARCHAR),
            @Result(column="message_sort_num", property="messageSortNum", jdbcType=JdbcType.INTEGER),
            @Result(column="message_type", property="messageType", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<MessageUnit> queryByConditions(MRecReq mRecReq);
}
